/**
 * FileName: DeviceInfoStore.cpp
 * Author:   kqbi
 * Date:     2019.7.12
 * Des:      �豸��Ϣ�洢
 */

#include "PlateInfoStore.h"

PlateInfoStore::PlateInfoStore(const std::weak_ptr<AbstractDb> &db) : _db(db) {
}

int PlateInfoStore::AddPlateInfo(std::string &plateName, std::string &plateType, float confidence, std::string &fPath,
                                 std::string &pPath, std::string &time) {
    auto strongSelf = _db.lock();
    if (!strongSelf) {
        return -1;
    }
    return strongSelf->AddPlateInfo(plateName, plateType, confidence, fPath, pPath, time);
}

void
PlateInfoStore::QueryPlateInfoList(int &sum, int startNum, int endNum, const std::string &startTime, const std::string &endTime,
                                   std::vector<AbstractDb::PlateInfoRecord> &plateInfoRecordList) {
    auto strongSelf = _db.lock();
    if (!strongSelf) {
        return;
    }
    strongSelf->QueryPlateInfoListSum(startTime, endTime, sum);
    strongSelf->QueryPlateInfoList(startNum, endNum, startTime, endTime, plateInfoRecordList);
}